The bin packing problem is closely related to the cutting stock problem, therefore we choose a similar formulation.

Let $N=\{1,\ldots,n\}$ denote the set of all items and $C \subseteq 2^N$ the set of all feasible bin configurations
\begin{equation}
	C = \left\{ I \subseteq N : \sum_{i \in I} l_i \leq W \right\}.
\end{equation}

We can formulate the IMP by using a Boolean variable for each feasible bin configuration:

\begin{align}
\min \quad z  = & \sum_{c \in C} \lambda_c \\
\mbox{s.t.} \quad & \sum_{c \in C: \, i \in c} \lambda_c = 1 & \forall i \in N \label{eq:ex8everyitem}\\
& \lambda_c \in \{0,1\} & \forall c \in C
\end{align}

Constraint~\eqref{eq:ex8everyitem} ensures that exactly one containing configuration is chosen for each item.